Export slot names from http2/core used cross-package#11
Conversation
|
Context on why this is needed:
Since This works today because The fix is minimal -- just export the 6 slot names that are referenced cross-package. |
payload-streams.lisp (in-package http2/stream-overlay) references slot names connection, peer-window-size, state, output-buffer, network-stream, and window-size via with-slots. These symbols are internal to http2/core. Per ANSI CL, :use only inherits exported symbols. Currently this works because mgl-pax:define-package shares all symbols, but with standard defpackage the with-slots forms would intern fresh symbols in http2/stream-overlay that don't match the actual slot names, causing slot-missing errors at runtime. Export the six slot names from http2/core so cross-package with-slots references resolve correctly regardless of the package definition macro used. This also enables downstream users who subclass http2-stream from other packages to access these slots without double-colon qualification.
849847b to
7904ec5
Compare
Summary
http2/corethat are referenced viawith-slotsinhttp2/stream-overlay(payload-streams.lisp):connection,peer-window-size,window-size,state,output-buffer,network-stream.Problem
payload-streams.lispis(in-package http2/stream-overlay)and useswith-slotsto access slots defined on classes inhttp2/core(e.g.,flow-control-mixin,http2-stream-minimal,buffered-stream,http2-connection).Since
http2/stream-overlay:useshttp2/core, only exported symbols are inherited. These slot names are currently internal tohttp2/core. Per ANSI CL,with-slotsin thehttp2/stream-overlaypackage context should intern fresh symbols that don't match the actual slot definitions, causingslot-missingerrors at runtime.This currently works because
mgl-pax:define-packagehappens to make the symbols accessible across packages. But the correctness depends onmgl-paxbehavior rather than the ANSI CL package system. Downstream code that subclasseshttp2-streamfrom other packages encounters this issue and requiresslot-missingworkarounds.Fix
Add
:exportfor the 6 slot names to thehttp2/corepackage definition. This makes the cross-packagewith-slotsreferences correct per ANSI CL regardless of whichdefpackageimplementation is used.Test plan
(eq (find-symbol "PEER-WINDOW-SIZE" :http2/stream-overlay) (find-symbol "PEER-WINDOW-SIZE" :http2/core))returns T